home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d913.lha / StickIt / CreateEmptyFile.rexx next >
OS/2 REXX Batch file  |  1993-10-03  |  704b  |  40 lines

  1. /*
  2.    CreateEmptyFile.rexx         ©1993 Andy Dean
  3.    ~~~~~~~~~~~~~~~~~~~~         ~~~~~~~~~~~~~~~
  4.    Opens an file for writing which it then promptly closes. This results
  5. in a file of length 0 bytes.
  6.  
  7. */
  8.  
  9. say "CreateEmptyFile ©1993 Andy Dean"
  10.  
  11. if (arg() ~= 1) then do
  12.    options prompt "Enter filename for empty file : "
  13.    parse pull fname
  14.    end
  15. else do
  16.    fname = arg(1)
  17.    end
  18.  
  19. if (fname = "") then do
  20.    say "Error : Invalid filename"
  21.    exit
  22.    end
  23.  
  24. result = open(temp,fname,"Write")
  25.  
  26. if (result ~= 1) then do
  27.    say "Can't open file "fname
  28.    exit
  29.    end
  30.  
  31. result = close(temp)
  32.  
  33. if (result ~= 1) then do
  34.    say "Can't close file "fname
  35.    exit
  36.    end
  37.  
  38. say "Empty file ``"fname"'' created..."
  39. exit
  40.